#!/usr/bin/env python
# encoding: utf-8

import torchaudio
import torch

def add_deltas(specgram):
    delta1 = torchaudio.functional.compute_deltas(specgram)
    delta2 = torchaudio.functional.compute_deltas(delta1)
    specgram = torch.cat([specgram, delta1, delta2], axis=2)
    return specgram

def compute_vad(wavefrom, sample_rate):
    wavefrom = torch.from_numpy(wavefrom.copy())
    wavefrom = torchaudio.functional.vad(wavefrom, sample_rate)
    return wavefrom

if __name__ == "__main__":
    data = torch.randn(10, 1, 100, 30)
    data = add_deltas(data)
    print(data.shape)
